// app.js
import { login } from "./API/api"
App({
  onLaunch() {
    //查看登录状态
   login().then(res => {
      // console.log(res);
      if (res.data.code == 0) {
        this.globalData.isLogin = true
        this.globalData.userInfo = res.data.data

      }
      // console.log(this.globalData.userInfo);
    })
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
      }
    })
  },
  globalData: {
    userInfo: null,
    islogin: false
  }
})
